﻿define(function (require, exports, module) {
    var ImageStorage = require('imageStorage');
    var Canvas = require('canvas');

    function Area(data) {
        this.x = data.X;
        this.y = data.Y;
        this.img = Canvas.createImage({ image: ImageStorage.get(data.Img), x: this.x, y: this.y });
    };

    Area.prototype.renderOnMap = function (x, y) {
        this.img.setPosition(this.x - x, this.y - y);
    };

    exports.createInstance = function (layer, data) {
        var area = new Area(data);
        layer.add(area.img);
        return area;
    };
});